package com.sam4cloud.oauth2.project.model.dto;

import com.sam4cloud.oauth2.project.enums.LoginTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
@ApiModel(value = "LoginDTO对象", description = "登陆请求")
public class LoginDTO {


    @NotBlank(groups = {PCLogin.class}, message = "登录名称不能为空")
    @ApiModelProperty(value = "手机号", example = "13500666888")
    private String loginName;

    @NotBlank(groups = {PCLogin.class}, message = "密码不能为空")
    @ApiModelProperty(value = "密码", example = "xxxx")
    private String password;

    @NotBlank(groups = {PCLogin.class}, message = "验证码不能为空")
    @Pattern(regexp = "\\d{6}", message = "请输入6位数字")
    @ApiModelProperty(value = "验证码", example = "123456")
    private String code;

    @ApiModelProperty(value = "登录方式(account/sms/wx_mp/wx_mini)", example = "account")
    @NotBlank(groups = {PCLogin.class}, message = "登录方式不能为空")
    private LoginTypeEnum loginType;


    @NotBlank(groups = {TokenLogin.class}, message = "企业id不能为空")
    @ApiModelProperty(value = "企业id", example = "xxxx")
    private String appId;


    @NotBlank(groups = {TokenLogin.class}, message = "企业密钥不能为空")
    @ApiModelProperty(value = "企业密钥", example = "xxxx")
    private String appSecret;


    @NotBlank(groups = {TokenLogin.class}, message = "应用id不能为空")
    @ApiModelProperty(value = "应用id", example = "xxxx")
    private String agentId;

    @ApiModelProperty(value = "是否检查密码", hidden = true)
    private Boolean checkPsw;

    public interface PCLogin {

    }

    public interface TokenLogin {

    }
}
